#ifndef MYWIDGET_H
#define MYWIDGET_H

#include <QWidget>

QT_BEGIN_NAMESPACE
class QLabel;
class QPushButton;
QT_END_NAMESPACE

class TargetSheet;
class MyTableWidget;
#include <QString>
#include <QTableWidgetItem>
#include <QTableWidget>

#include"model.h"
#include"targetsheet.h"
#include"config/constvariable.h"



class MyWidget : public QWidget
{
  Q_OBJECT

public:
  explicit MyWidget(QWidget *parent = nullptr);
~MyWidget();

  void create();

  void createTable();

signals:
  void mySignalBtn();

  void mySignal(const QList<QPointF>& msg);

  //开启校准
//  checkSignal(int);

  //校准X，Y
  void checkXSignal(int);
  void checkYSignal(int);

  void checkXandY(int,int,int);
public slots:

  void getIndex(int msg);

  void clearBtn();

  void checkBtn();
  //获取数据库表1数据
  void passHolesData(const QMap<int,QVector<OneTaregtBullet>>& data);
  //获取数据库表1数据
  void passName(const QVector<Target_Info_Table>& data,int);

  void passBatteryData(const QVector<double> &msg);

//  void checkUpSlot();


private:

  double scalex;
    double labelXY;

  TargetSheet *targetSheet = nullptr;
//  MyTableWidget *myTable = nullptr;

  QTableWidget *tableWidget = nullptr;

  QWidget *widget = nullptr;

  //姓名
    QLabel *labelName = nullptr;
  //靶号
  QLabel *labelBaHao = nullptr;
  //总环数
  QLabel *labelSum = nullptr;
  //电量
  QLabel *labelBattery = nullptr;

  //中弹数
  QLabel *zhongDanShu = nullptr;

  //清除按钮
  QPushButton *clearButton = nullptr;

  //清除按钮
  QPushButton *checkButton = nullptr;

  QWidget *checkWidget = nullptr;

  int index = 4,s_index = 0;

  QString user_name = "";

  int addr = 0;

  int after_rows = 0;

  int curX = 0,curY = 0;

  QTimer *upTimer = nullptr;

  QTimer *downTimer = nullptr;

  QTimer *leftTimer = nullptr;

  QTimer *rightTimer = nullptr;

};

#endif // MAINWINDOW_H
